﻿using BloomFilter;
using System;
using System.Diagnostics;

namespace Demo
{
    class Program
    {
        static void Main()
        {
            var start = Stopwatch.GetTimestamp();
            TestA();
            Console.WriteLine((Stopwatch.GetTimestamp() - start) * 1000 / Stopwatch.Frequency);
            Console.WriteLine();

            Console.ReadLine();
        }

        private static void TestA()
        {
            const int count = 10000000;
            var bloom = new FilterMemory(count, 0.001, new Murmur3Better());
            for (var i = 0; i < count; i++)
            {
                bloom.Add(Guid.NewGuid().ToString("N"));
            }
            Console.WriteLine(count);

            int errorCount = 0;
            for (var i = count; i < count * 2; i++)
            {
                var sw = new Stopwatch();
                sw.Start();
                var temp = bloom.Contains(Guid.NewGuid().ToString("N"));
                sw.Stop();
                if (temp)
                {
                    errorCount++;
                }
            }
            Console.WriteLine(bloom);
            Console.WriteLine($"finish {errorCount}");
        }
    }
}
